﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MINERP.DisjoinProForOutShop.IView;
using MINERP.MODEL.FoundationModel;

namespace MINERP.DisjoinProForOutShop.Forms
{
    public partial class ShopUGrid : UGrid, IGrid
    {
        public ShopUGrid()
        {
            InitializeComponent();
        }
        //public int GridId { get; set; }
        public int ShopId { get; set; }
        public string GridName 
        { set { this.labGridName.Text = value;}
          get { return this.labGridName.Text; }
        }
        
   
      
        //public int NumCurr
        //{
        //    //set { this.labelControl_ProductNum.Text = value.ToString(); }
        //    //get { return Convert.ToInt32(this.labelControl_ProductNum.Text); }
        //}

        public DateTime FristEnterTime { set; get; }
        public DateTime CompleteTime
        { set; get; }

        public String ShopName 
        { 
            set 
            {
                this.labelControlShopName.Text = value.ToString();
            }
            get
            {
                return labelControlShopName.Text;
            }
        }

        public string OrderTime {
            get { return labelControlOrdertime.Text; }
            set { labelControlOrdertime.Text = value.ToString(); }
        }

        public string CtmName
        {
            get { return labelControlCtmName.Text; }
            set
            {
                if (value != null)
                {
                    labelControlCtmName.Text = value.ToString();
                }
                else
                {
                    labelControlCtmName.Text = "";
                }
            }
        }

        public string OrderNum
        {
            get { return labelControlNum.Text; }
            set
            {
                if (value == null)
                {
                    labelControlNum.Text = "";

                }
                else
                {
                    labelControlNum.Text = value.ToString();
                }
            }
        }

        public string OrderName
        {
            get { return labelControlOrderName.Text; }
            set
            {
                if (value != null)
                {
                    labelControlOrderName.Text = value.ToString();
                }
                else
                {
                    labelControlOrderName.Text ="";
                }
            }
        }

        private void UGrid_Load(object sender, EventArgs e)
        {
            //SetEvent(this);
        }

        public Grid_Info Grid
        {
            get; set;
        }

        public void ClearGrid()
        {
            ShopName = "";
            //NumCurr = 0;
        }
        public void SetEvent(Control control)
        {
            control.Click += new EventHandler(ShopUGrid_Click);
            control.DoubleClick += new EventHandler(ShopUGrid_DoubleClick);
            ControlCollection ccl = control.Controls;
            foreach (Control collection in ccl)
            {
                SetEvent(collection);
            }

        }
        public delegate void PostClicks(ShopUGrid shopUGrid);

        public event PostClicks ShopDoubleClick;
        public event PostClicks ShopClick;
        private void ShopUGrid_Click(object sender, EventArgs e)
        {
            ShopClick(this);
        }

        private void ShopUGrid_DoubleClick(object sender, EventArgs e)
        {
            ShopDoubleClick(this);
        }

        private void labGridName_Click(object sender, EventArgs e)
        {
            ShopClick(this);
        }

        private void labelControlShopName_Click(object sender, EventArgs e)
        {
            ShopClick(this);
        }

        private void labGridName_DoubleClick(object sender, EventArgs e)
        {
            ShopDoubleClick(this);
        }

        private void labelControlShopName_DoubleClick(object sender, EventArgs e)
        {
            ShopDoubleClick(this);
        }
    }
}
